<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改直播设置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-liveconfig-edit" th:object="${whzjLiveconfig}">
            <input id="id" name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">每小时单价：</label>
                <div class="col-sm-8">
                    <input id="priceHour" name="priceHour" th:field="*{priceHour}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">直播间首页曝光消耗积分：</label>
                <div class="col-sm-8">
                    <input id="liveHome" name="liveHome" th:field="*{liveHome}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">直播预告描述：</label>
                <div class="col-sm-8">
                    <textarea id="liveDesc" name="liveDesc" class="form-control">[[*{liveDesc}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">看直播赠送积分：</label>
                <div class="col-sm-8">
                    <input id="liveSend" name="liveSend" th:field="*{liveSend}" class="form-control" type="text">
                </div>
            </div>
            <div style="text-align: center" class="form-group">
                <div class="col-sm-8">
                    <button type="button" class="btn btn-primary" onclick="saveSetting();">提交</button>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "whzj/liveconfig";
        $("#form-liveconfig-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-liveconfig-edit').serialize());
            }
        }

        function saveSetting() {
            /*if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-tasksetting-edit').serialize());
            }*/
            var formData = new FormData();
            formData.append('id',$("#id").val());
            formData.append('priceHour',$("#priceHour").val());
            formData.append('liveHome',$("#liveHome").val());
            formData.append('liveDesc',$("#liveDesc").val());
            formData.append('liveSend',$("#liveSend").val());
            $.ajax({
                url: prefix + "/edit",
                type: 'post',
                cache: false,
                data: formData,
                processData: false,
                contentType: false,
                dataType: "json",
                success: function(result) {
                    $.operate.successCallback(result);
                }
            });
        }
    </script>
</body>
</html>